package org.bookr.engine.model;

import java.util.HashSet;
import java.util.Set;

/**
 * @author Pawel Tomaszewski
 */
public class Reader extends AuthenticablePerson {
    protected Set<Comment> comments = new HashSet<Comment>();
    protected Group group;

    public Set<Comment> getComments() {
        return comments;
    }

    public void setComments(Set<Comment> comments) {
        this.comments = comments;
    }

    public Group getGroup() {
        return group;
    }

    public void setGroup(Group group) {
        this.group = group;
    }

    public void addComment(Comment comment) {
        if(!comments.contains(comment)) {
            comments.add(comment);
            comment.setReader(this);
        }
    }

    public void removeComment(Comment comment) {
        if(comments.contains(comment)) {
            comments.remove(comment);
            comment.setReader(null);
        }
    }
}